package com.fzh.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.fzh.mapper.AddressMapper;
import com.fzh.pojo.entity.Address;
import com.fzh.pojo.utils.ResponeMessageUtil;
import com.fzh.service.AddressService;

@Service
public class AddressServiceImpl implements AddressService {
	
	@Autowired
	private AddressMapper addressMapper;

	@Override
	public List<Address> queryAllAddress() {
		return addressMapper.selectAllAddress();
	}

	public Address selectAddressById(Integer id){
		return addressMapper.selectAddressById(id);
	};
	@Override
	public Integer queryAddressCounts() {
		return addressMapper.selectAddressCounts();
	}

	@Override
	public List<Address> queryAllAddressByUserIdF(Integer userId) {
		return addressMapper.selectAllAddressByUserIdF(userId);
	}

	@Override
	public Address queryAllAddressByUserIdAndNumberF(Integer userId, Integer number) {
		return addressMapper.selectAllAddressByUserIdAndNumberF(userId,number);
	}

	@Override
	public Integer deleteById(Integer id) {
		return addressMapper.delAddressById(id);
	}

	@Override
	public Boolean addAddressById(Address address) {
		return ResponeMessageUtil.getResMsg(addressMapper.addAddressById(address));
	}

	@Override
	public Boolean updateAddressById(Address address) {
		return ResponeMessageUtil.getResMsg(addressMapper.updateAddressById(address));
	}

}
